#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    float a = 0;
    int n = 0;
    int m = 0;
    int k = 0;
    float c = 0;
    scanf("%f %d %d %d", &a, &n, &m, &k);
    if (n == 11)
    {
        c = a * 0.7;
        if (k == 1)
        {
            c = c - 50 < 0 ? 0 : c;
            printf("%.2f", c);
        }
        else {
            printf("%.2f", c);
        }
    }
    else
    {
        c = a * 0.8;
        if (k == 1)
        {
            c = c - 50 < 0 ? 0 : c;
            printf("%.2f", c);
        }
        else {
            printf("%.2f", c);
        }
    }
    return 0;
}